﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TAS
{
    public static class MathUtils
    {
        static Random randomSeed = null;

        public static double Average(List<double> numbers)
        {
            return numbers.Average();
        }

        public static double StandardDeviation(List<double> numbers)
        {
            double mean = Average(numbers);
            double sum = 0;

            foreach (var number in numbers)
            {
                sum = (mean - number) * (mean - number);
            }

            return Math.Sqrt(sum / numbers.Count);
        }

        public static int Randomize(int MaxValue)
        {
            if (randomSeed == null)
            {
                randomSeed = new Random();
            }

            return randomSeed.Next(MaxValue);
        }
    }
}
